home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c / 156 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1.6 KB

  1. Path: engr.sgi.com!shankar
  2. From: shankar@engr.sgi.com (Shankar Unni)
  3. Newsgroups: comp.std.c
  4. Subject: Re: [Q] 16bit, 32bit, 64bit ints, longs etc.
  5. Date: 22 Jan 1996 02:55:35 GMT
  6. Organization: Silicon Graphics, Inc., Mountain View, CA
  7. Distribution: world
  8. Message-ID: <4duub7$3cf@fido.asd.sgi.com>
  9. References: <4dtgug$5mf@cc.tut.fi>
  10. Reply-To: shankar@engr.sgi.com
  11. NNTP-Posting-Host: boris.engr.sgi.com
  12. X-Newsreader: TIN [version 1.2 PL2]
  13.  
  14. Koivisto Hannu (k152608@proffa.cc.tut.fi) wrote:
  15.  
  16. > 64bit. You see, I thought that in 64bit systems ints would be 64bit and 
  17. > longs 64bit. However, when I tried this with gcc running on an Alpha 
  18. > machine, it turned out that ints are 32bit and longs are 64bit(of course, 
  19. > pointers are also 64bit).
  20.  
  21. [ Non-standards-related digression ]
  22.  
  23. This is usually a matter of trading off programming convenience against
  24. loss of performance.
  25.  
  26. If every loop counter and temporary value (ints) were 64 bits, your memory
  27. requirements could balloon. On the other hand, having ints be 32 bits means
  28. that if you forget to declare malloc() (a common failing in old code), you
  29. could end up with garbage..
  30.  
  31. It's a judgement call.
  32.  
  33. Incidentally, many vendors are starting to ship files like "inttypes.h" (I
  34. know Solaris and Irix have this file; and I'm sure many others do as
  35. well), to declare integral types of known size, like "int32_t", "int64_t",
  36. etc., so that you can choose exactly what sizes you want regardless of the
  37. architecture you are porting your code to.
  38.  
  39. --
  40. Shankar Unni                E-Mail:    shankar@sgi.com
  41. Silicon Graphics Inc.            Phone:    +1-415-933-2072
  42. URL:    http://reality.sgi.com/employees/shankar
  43.